package com.example.e_comm.dto;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class BaseResp<T> {
    private int code;   // 0 成功
    private String msg;
    private T data;

    public static <T> BaseResp<T> ok(T data) {
        return new BaseResp<>(0, "success", data);
    }
    public static <T> BaseResp<T> fail(String msg) {
        return new BaseResp<>(-1, msg, null);
    }
}
